<template>
    <div class="bannerLL">
        <div class="bannerLL-card">
            <div class="bannerLL-head">
                <ButtonGroup style="float: right">
                    <Button type="primary" @click="$router.push({name:'banner-nocache'})"><Icon type="plus-round"></Icon> 新 增</Button>
                </ButtonGroup>
            </div>
            <i-table ref="tableCsv" height="730" stripe :columns="columns" :data="data"></i-table>
        </div>
        <Modal v-model="modal2" width="360">
            <p slot="header" style="color:#f60;text-align:center">
                <Icon type="ios-information-circle"></Icon>
                <a>删除</a>
            </p>
            <div style="text-align:center">
                <p>确定删除当前吗?</p>
            </div>
            <div slot="footer">
                <Button type="primary" size="large" long :loading="modal_loading" @click="del">删除</Button>
            </div>
        </Modal>
    </div>
</template>

<script>
    export default {
        name: "bannerLLlist",
        data(){
            return{
                modal2:false,
                columns:[
                    {
                        title: '序号',
                        type: 'index',
                        width: 60,
                        align:"center",
                    },
                    {
                        title: '用户',
                        key: 'user_name',
                        align:"center",
                    },
                    {
                        title: '奖励数量',
                        key: 'num',
                        align:"center",
                    },
                    {
                        title: '币种名称',
                        key: 'currency_name',
                        align:"center",
                    },
                    /*{
                        title: '操作',
                        key: 'action',
                        align: 'center',
                        width:300,
                        render: (h, params) => {
                            return h('ButtonGroup', [
                                h('Button', {
                                    props: {
                                        type: 'primary',
                                    },
                                    on: {
                                        click: () => {
                                            this.$router.push({name:"banner-nocache",query:{id:params.row.id}})
                                        }
                                    }
                                },"修改"),
                                h('Button', {
                                    props: {
                                        type: 'primary',
                                    },
                                    on: {
                                        click: () => {
                                            this.id=params.row.id
                                            this.modal2=true
                                        }
                                    }
                                },"删除"),
                            ]);
                        }
                    },*/
                ],
                data:[],
                id:"",
                modal_loading:false,
            }
        },
        activated(){
            this.getList()
        },
        methods:{
            //获取列表数据
            getList(){
                this.getJsonData("table/query_table_log")
                    .then((res)=>{
                        this.data=res.result
                    })
            },
            del(){
                this.modal_loading=true
                this.getJsonData("table/delete_table",{id:this.id},true)
                    .then((res)=>{
                        this.modal_loading=false
                        this.modal2=false
                        this.$Message.success("删除成功")
                        this.getList()
                    })
                    .catch(()=>{
                        this.modal_loading=false
                    })
            }
        }
    }
</script>

<style scoped lang="less">
    @import "bannerLL";
</style>